#!/bin/bash

cd "$(dirname "$0")"  # 将脚本所在目录设为当前工作目录
# Compile cjson
cd cjson
mkdir build
cd build
cmake ..
make
cp libcjson.so ../../
cp libcjson.so.1 ../../
cd ../..

# Compile jsoncpp
cd jsoncpp
mkdir build
cd build
cmake ..
make
cp lib/libjsoncpp.so ../../
cd ../..

# Compile and run test.cpp
g++ test.cpp -o test -I./cjson -I./jsoncpp/include -I./json/include -L./ -lcjson -ljsoncpp
export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH
./test